package MyStack;

import java.util.Stack;

/**
 * @author gao
 * @date 2025/6/3 15:50)
 */

public class Solution3 {
    public static void main(String[] args) {
        Stack<Integer> stack = new Stack<>();//创建栈，后进先出

        System.out.println(stack.isEmpty());//判断站是否为空

        stack.push(5);//添加元素
        stack.push(4);
        stack.push(3);
        stack.push(2);
        stack.push(1);

        System.out.println(stack.isEmpty());

        System.out.println(stack.peek());//获取栈顶元素
        System.out.println(stack.pop());//栈顶元素弹出

        System.out.println(stack.peek());
        System.out.println(stack.pop());
    }
}
